<!DOCTYPE html>
<html lang="zh_CN">

<head>
   <#include "../common/header.ftl">

    <script>
        $(function () {
            //游记状态的修改 发布 和拒绝
            $(".stateBtn").click(function () {
                //获取按钮上的状态
                var state = $(this).data("state");
                //获取按钮上的id
                var id = $(this).data("id");

                $.get("/travel/changeState.do",{"state":state,"id":id},function (data) {
                    if(data.success){
                        window.location.reload();
                    }
                })
            })
            //游记内容的查看
            $(".showContent").click(function () {
                //获取按钮上的id
                var id = $(this).data("id");
                $.get("/travel/getTravelContent.do",{"travelId":id},function (data) {
                    console.log(data);
                    $("#showContentModal .modal-body").html(data.content);
                    $("#showContentModal").modal('show');

                })
            })
        })
    </script>
    <!--设置模态框的样式-->
    <style>
        #showContentModal img{
            width: 100%;
        }
        #showContentModal .modal-body{
            max-height: 500px;
            overflow-y: auto;
        }

    </style>
</head>

<body>

<!--模态框-->
<div class="modal fade" id="showContentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">游记的内容</h4>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>


<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
        <#--设置当前要回显当前菜单,必须在载人菜单前完成设置-->
            <c:set var="menu" value="department"/>
                <#assign menu = "travel" >
           <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记管理</h1>
                </div>
            </div>

            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
                <input type="hidden" id="currentPage" name="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入标题">
                </div>

                <#--<select id="auditState" class="form-control" autocomplete="off"  name="state">
                    <option value="-1">全部</option>
                    <option value="2">待审核</option>
                    <option value="0">已拒绝</option>
                </select>

                <script>
                    $("#auditState").val(${(qo.state)!})
                </script>-->




                <button type="submit" class="btn btn-primary">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>

            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                </tr>
                <!--如果result不为空就迭代输出-->
                    <#if result??>
                        <#list result.list as entity>
                        <tr>
                            <td>${entity.title}</td>
                            <td><img src="${(entity.coverUrl)!}" width="30px"></td>
                            <td>${(entity.place.name)!}</td>
                            <td>${(entity.author.nickName)!}</td>
                            <td>${(entity.stateName)!}</td>

                            <td><a href="javascript:;" class="btn stateBtn" data-state="3" data-id="${entity.id}">发布</a></td>
                            <td><a href="javascript:;" class="btn stateBtn" data-state="0" data-id="${entity.id}">拒绝</a></td>
                            <td><a href="javascript:;" class="btn showContent" data-id="${entity.id}" >查看文章</a></td>

                        </tr>
                        </#list>
                    </#if>
            </table>
            <!--分页-->
            <#include "../common/page.ftl">
        </div>
    </div>
</div>


</body>

</html>